using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vOeDet_ItemDescMap : EntityTypeConfiguration<vOeDet_ItemDesc>
    {
        public vOeDet_ItemDescMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ITEMNUM, t.ITEMDESC, t.NUMBER, t.TYPE, t.ITEM, t.QTYSHIP, t.COST, t.ITEMTYPE, t.CURRENCY, t.EXTENDACCT, t.PRICEACCT, t.TRANSID, t.DISCPERC, t.BILLORDER, t.USERID, t.KACT, t.AREACT, t.ORACT, t.LACT, t.RACT, t.PATAMTACT, t.INS1AMTACT, t.INS2AMTACT, t.DISCOUNTA });

            // Properties
            this.Property(t => t.ITEMNUM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.ITEMDESC)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.NUMBER)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.TYPE)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.LOCATION)
                .HasMaxLength(3);

            this.Property(t => t.EXPDATE)
                .HasMaxLength(6);

            this.Property(t => t.ITEMTYPE)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CURRENCY)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.TRANSID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.BILLORDER)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.USERID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("vOeDet_ItemDesc");
            this.Property(t => t.ITEMNUM).HasColumnName("ITEMNUM");
            this.Property(t => t.ITEMDESC).HasColumnName("ITEMDESC");
            this.Property(t => t.NUMBER).HasColumnName("NUMBER");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.LOCATION).HasColumnName("LOCATION");
            this.Property(t => t.QTYSHIP).HasColumnName("QTYSHIP");
            this.Property(t => t.QTYORDER).HasColumnName("QTYORDER");
            this.Property(t => t.COST).HasColumnName("COST");
            this.Property(t => t.NOTES).HasColumnName("NOTES");
            this.Property(t => t.EXPDATE).HasColumnName("EXPDATE");
            this.Property(t => t.ENTRY_DATE).HasColumnName("ENTRY_DATE");
            this.Property(t => t.ITEMTYPE).HasColumnName("ITEMTYPE");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.EXTENDACCT).HasColumnName("EXTENDACCT");
            this.Property(t => t.PRICEACCT).HasColumnName("PRICEACCT");
            this.Property(t => t.TRANSID).HasColumnName("TRANSID");
            this.Property(t => t.DISCPERC).HasColumnName("DISCPERC");
            this.Property(t => t.BILLORDER).HasColumnName("BILLORDER");
            this.Property(t => t.USERID).HasColumnName("USERID");
            this.Property(t => t.KACT).HasColumnName("KACT");
            this.Property(t => t.AREACT).HasColumnName("AREACT");
            this.Property(t => t.ORACT).HasColumnName("ORACT");
            this.Property(t => t.LACT).HasColumnName("LACT");
            this.Property(t => t.RACT).HasColumnName("RACT");
            this.Property(t => t.PATAMTACT).HasColumnName("PATAMTACT");
            this.Property(t => t.INS1AMTACT).HasColumnName("INS1AMTACT");
            this.Property(t => t.INS2AMTACT).HasColumnName("INS2AMTACT");
            this.Property(t => t.DISCOUNTA).HasColumnName("DISCOUNTA");
        }
    }
}
